public class NotRepeatCharacter1 {
    //方法2
    public static int FirstNotRepeatChar(String s) {
        int returnnum = 0;
        char[] s1 = s.toCharArray();
        int i = 0;
        int j = 0;
        for ( i = 0; i < s.length(); i++) {
            for ( j = 0; j < s.length(); j++) {
                if (s1[i] == s1[j] && i != j) {
                    break;
                }
            }
            if (j == s.length()) {
                    returnnum = i;
                    break;
            }
        }
        if ( i == s.length()) {
            returnnum = -1;
        }
        return returnnum ;
    }
    public static void main(String[] args) {
        String s = "cbbca";//给定的字符串
        //以数组的形式打印字符串
        int ret = FirstNotRepeatChar(s);
        System.out.println(ret);
    }
}